<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="templates/template.xhtml">
	<ui:define name="context">
		<ui:include src="contextmenu.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form id="documentForm">
			<p:growl id="growl" showDetail="true" />
			<p:panel header="Crear origenes de datos">
				<p:panelGrid columns="2" styleClass="align_top">
					<h:outputLabel for="source_name" value="Nombre Origen: *" />
					<p:inputText id="source_name" value="#{source.sourceDTO.name}"
						label="source_name" />
					<h:outputLabel for="source_name" value="URL: *" />
					<p:inputText id="source_url" value="#{source.sourceDTO.url}"
						label="source_url" />
					<f:facet name="footer">
						<p:commandButton actionListener="#{source.createSource}"
							value="Guardar" update="sources">
						</p:commandButton>
					</f:facet>
				</p:panelGrid>
			</p:panel>
			<p:outputPanel id="sources">
				<p:panelGrid columns="2" styleClass="align_top">
					<p:dataTable id="sourcesTable" value="#{source.rssSourceCol}"
						var="sourceCol" selection="#{source.sourceRSSSelected}"
						selectionMode="single" rowKey="#{sourceCol.name}">
						<f:facet name="header">  
			            Origenes de Datos RSS 
			        </f:facet>
						<p:ajax event="rowSelect" listener="#{source.onRowSelect}" />
						<p:column>
							<f:facet name="header">
								<h:outputText value="Nombre" />
							</f:facet>
							<h:outputText value="#{sourceCol.name}" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="URL" />
							</f:facet>
							<h:outputLink value="#{sourceCol.url}">#{sourceCol.url}</h:outputLink>
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Fecha Ultima Publicacion" />
							</f:facet>
							<h:outputText value="#{sourceCol.lastQuery}" />
						</p:column>
						<f:facet id="footer" name="footer">
							<p:commandButton id="delete" value="Eliminar"
								actionListener="#{source.deleteRssSource}" update="sourcesTable" />
						</f:facet>
					</p:dataTable>
					<p:dataTable id="twitterTable" value="#{source.twitterSourceCol}"
						var="sourceCol" selection="#{source.sourceTwitterSelected}"
						selectionMode="single" rowKey="#{sourceCol.name}">
						<f:facet name="header">  
			            Origenes de Datos Twitter
			        </f:facet>
						<p:ajax event="rowSelect" listener="#{source.onRowSelect}" />
						<p:column>
							<f:facet name="header">
								<h:outputText value="Nombre" />
							</f:facet>
							<h:outputText value="#{sourceCol.name}" />
					</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="URL" />
							</f:facet>
							<h:outputLink value="#{sourceCol.url}">#{sourceCol.url}</h:outputLink>
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Ultimo Id" />
							</f:facet>
							<h:outputText value="#{sourceCol.sinceId}" />
						</p:column>
						
						<f:facet name="footer">
							<p:commandButton id="delete1" value="Eliminar"
								actionListener="#{source.deleteTwitterSource}" update="twitterTable" />
						</f:facet>
					</p:dataTable>
				</p:panelGrid>
			</p:outputPanel>
		</h:form>
	</ui:define>
</ui:composition>